<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理系统首页</title>
    <meta content="text/html;charset=utf-8" http-equiv="content-type">
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery.bootstrapvalidator/0.5.3/js/bootstrapValidator.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery.bootstrapvalidator/0.5.3/js/language/zh_CN.js"></script>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>
    <script src="asserts/js/AdminAjax.js" rel="script"></script>
    <link href="asserts/css/systemPage.css" rel="stylesheet">
    <script type="text/javascript">
        $(function () {
            listname();
            $("#logout_1").click(function () {
                alert("11");
                logout();
            })
            myGetAjax(
                "/catering_system_admin/admin/getData",
                {},
                getMyData
            )
            $("#analysis").click(function () {
                window.open("/system_operate/table.html")
            })
        })
        function getMyData(RespVo) {
            alert(RespVo.data.orderList.length);
            if (RespVo.code=="200"){
                $("#shopNum").text(RespVo.data.shopNum);
                $("#userNum").text(RespVo.data.userNum);
                $("#orderSum").text(RespVo.data.orderSum);
                $("#money").text(RespVo.data.allPrice);
                var str="";
                for (var i = 0; i <RespVo.data.orderList.length ; i++) {
                    str += "<tr>" +
                        "<td>" + RespVo.data.orderList[i].orderId + "</td>" +
                        "<td>" + RespVo.data.orderList[i].userId + "</td>" +
                        "<td>" + RespVo.data.orderList[i].shopId + "</td>" +
                        "<td>" + RespVo.data.orderList[i].foodId + "</td>" +
                        "<td>" + RespVo.data.orderList[i].orderNum + "</td>" +
                        "<td>" + RespVo.data.orderList[i].orderAllPrice + "</td>" +
                        "<td>"+formatDate(RespVo.data.orderList[i].orderCreatTime)+"</td>" +
                        "<td>"+RespVo.data.orderList[i].stateId+"</td>";
                    "</tr>";
                }
                $("#allOrder").html(str);
            } else {
                alert("获取数据失败")
            }
        }

        //时间戳转换
        function add0(m){return m<10?'0'+m:m }
        function formatDate(timestamp)
        {
            //timestamp是整数，否则要parseInt转换
            var time = new Date(timestamp);
            var y = time.getFullYear();
            var m = time.getMonth()+1;
            var d = time.getDate();
            var h = time.getHours();
            var mm = time.getMinutes();
            var s = time.getSeconds();
            return y+'-'+add0(m)+'-'+add0(d)+' '+add0(h)+':'+add0(mm)+':'+add0(s);
        }
    </script>
</head>
<body>
<div class="container-fluid">
    <div class="container">
        <div class="row" id="row_1">
            <form class="form-horizontal">
                <div class="col-lg-4" id="col-1">
                    <div class="form-group">
                        <label id="lable_1">餐饮管理系统</label>&nbsp;&nbsp;&nbsp;<a href="index.html"
                                                                               class="login"
                                                                               target="_blank" id="login_1">亲，请登录</a>
                    </div>
                </div>
                <div class="col-lg-3" id="col_2">
                </div>
                <div class="col-lg-1" id="col_3">
                </div>
                <div class="col-lg-4" id="col_4">
                    <div id="logout">
                        <a href="myCenter.html" target="_blank" id="center">个人中心</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                        <a href="systemPage.html" target="_blank">首页</a>&nbsp;&nbsp;&nbsp;
                        <a href="#" id="logout_1">注销</a>
                    </div>
                </div>
            </form>
        </div>
        <div class="row" id="row_2">
            欢&nbsp;&nbsp;&nbsp;&nbsp;
            迎&nbsp;&nbsp;&nbsp;&nbsp;
            来&nbsp;&nbsp;&nbsp;&nbsp;
            到&nbsp;&nbsp;&nbsp;&nbsp;
            餐&nbsp;&nbsp;&nbsp;&nbsp;
            饮&nbsp;&nbsp;&nbsp;&nbsp;
            系&nbsp;&nbsp;&nbsp;&nbsp;
            统&nbsp;&nbsp;&nbsp;&nbsp;
            管&nbsp;&nbsp;&nbsp;&nbsp;
            理
        </div>
        <div class="row" id="row_3">
            <div class="col-md-2" id="myButton">
                <div class="row">
                    <button type="button" class="btn btn-default btn-block btn-lg" id="userSystem">用户管理</button>
                </div>
                <div class="row">
                    <button type="button" class="btn btn-default btn-lg btn-block" id="shopSystem">商户管理</button>
                </div>
                <div class="row">
                    <button type="button" class="btn btn-default btn-block btn-lg" id="orderSystem">订单管理</button>
                </div>
                <div class="row">
                    <button type="button" class="btn btn-default btn-block btn-lg" id="analysis">运营分析</button>
                </div>
                <div class="row">
                    <button type="button" class="btn btn-default btn-block btn-lg" id="financeSystem">财务管理</button>
                </div>
            </div>
            <div class="col-md-10" id="mySystem">
                <div class="row">
                    <div class="col-md-2">
                        <div class="row">总店数</div>
                        <div class="row" id="shopNum">0</div>
                    </div>
                    <div class="col-md-2">
                        <div class="row" >总用户数</div>
                        <div class="row" id="userNum">0</div>
                    </div>
                    <div class="col-md-2">
                        <div class="row">总订单数</div>
                        <div class="row" id="orderSum">0</div>
                    </div>
                    <div class="col-md-2">
                        <div class="row">总金额</div>
                        <div class="row" id="money">0</div>
                    </div>
                </div>
                <div class="row">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>订单单号</th>
                            <th>用户id</th>
                            <th>商店id</th>
                            <th>餐品id</th>
                            <th>餐品数量</th>
                            <th>餐品总价</th>
                            <th>最后一次修改时间</th>
                            <th>订单状态</th>
                        </tr>
                        </thead>
                        <tbody id="allOrder">
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
        <div class="row" id="row_4">
            <div class="row">
                <div class="col-md-12">
                    千锋教育机构广州分校&nbsp;&nbsp;&nbsp;&nbsp;java-2103班第一小组&nbsp;&nbsp;&nbsp;&nbsp;版权所有
                </div>
            </div>
            <div class="row">
                <div class="col-md-2"></div>
                <div class="col-md-8" id="row_4_2">
                    相关连接：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="https://www.baidu.com"  target="_blank">百度</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="https://www.taobao.com" target="_blank">淘宝</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="https://www.jd.com" target="_blank">京东</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="https://www.bilibili.com" target="_blank">哔哩哔哩动画</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                    <a href="https://www.bilibili.com" target="_blank">斗鱼TV</a>
                </div>
                <div class="col-md-2"></div>
            </div>
        </div>
    </div>
</div>
</body>
</html>